<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        //es6新增的基本（原始）数据类型
        // 表示独一无二的属性
        let name = Symbol("name");
        const phone = Symbol("phone");
        
        const Person = {
            age:10,
            name:"张三",
            [name]:'狗蛋',
            [phone]:"18220050305"
        }
        // Person.name = "张三";
        // Person[name] = "狗蛋"; 
    
        //  	如果使用Symbol定义的对象中的属性,必须使用[变量名]来取值
        // console.log(Person[name]);

        //遍历对象时，Symbol类型的属性不能出来，因此不常用
        // for (const key in Person) {
        //     console.log(key,Person[key]);
        // }

      let keys =  Object.getOwnPropertySymbols(Person)
        console.log(keys);
        for (let i = 0;i< keys.length; i++){
            console.log( Person[keys[i]]);
        }
    </script>
</body>
</html>